﻿using UnityEditor;
using UnityEngine;

public partial class ScriptGenerator
{

    public class Config
    {
        public const string MenuDiretoryPrefix = "Assets/自定义脚本生成/";

        public const string DirectoryPrefix = "Assets/Editor/ScriptGenerator/";
        public static readonly string ScriptTemplateDirectory = DirectoryPrefix + "_TemplateScript/";
        public const string TarDirectoryPrefix = "Assets/Scripts/";

        public const string ScriptErrorLogger = @"../不正常注册事件的CS脚本.txt";

        #region DataTable

        public const string TableM5dPrefix = @"..";

        public static string AllTableMdFileName => $"{TableM5dPrefix}/AllTableMd5_{Application.productName}.xml";

        public const string DataTableBytePath = "Assets/Game/Repository/DataTables/Byte";
        public const string DataTableTxtPath = "Assets/Game/Repository/DataTables/Txt";
        public const string CSharpCodePath = TarDirectoryPrefix + "DataTable";
        public static readonly string CSharpCodeTemplateFileName = ScriptTemplateDirectory + "DataTableCodeTemplate.txt";

        public const string UIFormIdFileName = "Assets/Game/Scripts/Definition/Config/Generator/UIFormId.cs";

        public const string I18nFileDic = "Assets/Game/Scripts/Definition/Constant/I18N";
        public const string I18nFileName = I18nFileDic + "/Constant.I18NKey.Generator.cs";

        public static string RawDataFileDirectoryKey
        {
            get
            {
                int hashCode = Application.dataPath.GetHashCode();
                string key = "DataFileDiretory" + hashCode;
                return key;
            }
        }

        public static string RawDataFileDirectory
        {
            get
            {
                string rawDataFileDiretory = EditorPrefs.GetString(RawDataFileDirectoryKey);
                return rawDataFileDiretory;
            }
        }

        #endregion

        #region UGUI

        public const string UIFormDirectory = "Assets/Scripts/UIForms/";
        public static readonly string UIVariableCodeTemplateFileName = ScriptTemplateDirectory + "UIVariableTemplate.txt";
        public static readonly string UIFormCodeTemplateFileName = ScriptTemplateDirectory + "UIFormTemplate.txt";
        public static readonly string UIReuseItemVariableCodeTemplateFileName = ScriptTemplateDirectory + "UIReuseItemVariableTemplate.txt";
        public static readonly string UIReuseItemCtrlCodeTemplateFileName = ScriptTemplateDirectory + "UIReuseItemCtrlTemplate.txt";

        public static readonly string UIVariableDirectory = TarDirectoryPrefix + "UIForms/UIVariables/";
        public static readonly string UITemplateFileName = ScriptTemplateDirectory + "UITemplate.txt";

        #endregion
    }
}
